<!--
PAGE DOCUMENTATION:
==================
This page is used in an Ajax call to get the content of the play dialog  that
is activated when a user chooses to play a message.

Parameters that can be sent to this page:
----------------------------------------
filename - the name of the file to be played.
is_read - if the user chose to play a new message this parameter will be present.
			Value: 1.
index - Value: the DB index of the message the user performd an action on.
		will be passed only if the message is a new one.
sourceURL - the url of the page where the play command was given by user (getMessages.php 
			or sendMessage.php).
-->

<?php 
require_once('server.php');
$filename=$_REQUEST['filename'];

// if the message is new - create a form:
if (isset($_REQUEST['is_read'])) {
	$is_read=$_REQUEST['is_read'];
	$index=$_REQUEST['index'];
	$sourceURL=$_REQUEST['sourceURL'];
	echo "<form id=\"play_$index\" action=\"$sourceURL\" method=\"post\">
		<input type=\"hidden\" name=\"play\" value=\"play\"/>
		<input type=\"hidden\" name=\"filename\" value=\"$filename\"/>
		<input type=\"hidden\" name=\"index\" value=\"$index\"/>";
	if (!$is_read) {
		echo "<input type=\"hidden\" name=\"not_read\" value=\"$is_read\"/>";
	}
	echo "	</form>";
}

// activate flash player:
echo "
      <fb:swf 
  		swfbgcolor='#d8dfea' 
  		swfsrc='".SERVER."/Player.swf' 
  		width='100' 
  		height='100' 
  		flashvars='&filename=$filename' 
  		waitforclick='false' 
			loop='false' />   
    </div>";

?>